package week4;

import java.util.ArrayList;

public class Course {
    String subject;
    Student student;
    Float AverageScore, sum;
    int total = 0;
    ArrayList<Student> StudentList = new ArrayList<Student>();
    ArrayList<Float> ScoreList = new ArrayList<Float>();

    public Course(String sub){
        subject = sub;
    }

    public void addStudent(Student sd){
        student = sd;
        StudentList.add(student);
        ScoreList.add(student.average());
    }

    public float average(){
        int i = 0;
        float Sum = 0;
        while (i < ScoreList.size()){
            Sum += ScoreList.get(i);
            i += 1;
        }
        sum = Sum;
        AverageScore = sum /StudentList.size();
        return AverageScore;
    }

    public ArrayList roll(){
        return StudentList;
    }
}

